'======================================"
'   ???? ??????? ??????? ?? ??? ???? ????
'       kh_index ?????? ????? ?????
'======================================"
'              kh_index
'     ??? ???? ????? ?? ???? ?? ????
'       ???? ???????? ????? ?????
'======================================"
'    ??? ???? ???????? ??????? ???????
'            ????? ??????
'    ???????? ???  ?????? ????? ?????
'        MyArray  ?? ????? ??????
'      ?????? ????? ?? ????? ???
'        ????? ???????? ????????
'      ?? ?????? ???? ???? ?????
'           ?? ????? ???????
'======================================"


'-----------------------------------------------------------------

Function kh_Name(Name As String, Optional kh_index = 1) As String
Dim kh_ind As Integer
Dim kh_Split, MyArray, Ar
Dim Kh_String As String, Sn As String, Re As String, kh_Split_index As String, Kh_Rep As String
    
On Error GoTo Err_Kh_Name

    kh_ind = Val(kh_index)
    If kh_ind = 0 Then kh_ind = 1
    '======================================
    MyArray = Array("??? ", "??? ", "??? ", "?? " _
    , " ????", " ?????", " ???????", " ???????", " ????", "?? ", "???? ")
    '======================================
    Sn = Application.WorksheetFunction.Trim(Name)
    For Each Ar In MyArray
        Re = Replace(Ar, " ", "^")
        Sn = Replace(Sn, Ar, Re)
    Next
    '======================================
    Kh_String = Sn
    kh_Split = Split(Kh_String, " ", , vbTextCompare)
    kh_Split_index = kh_Split(kh_ind - 1)
    Kh_Rep = Replace(kh_Split_index, "^", " ")
    kh_Name = Kh_Rep
    
    Exit Function

Err_Kh_Name:
     kh_Name = ""
End Function

??? ????? ??????? ?? ???????? ??????? ??? ????? ????? ????

